/**

 * @File SummaryAccountTemplateController.java
 * @author Agam Bhamra
 * @Version 1.0
 * @Date July 27, 2013
 * 
 * Copyright (c) 2011 EdRP, Dayalbagh Educational Institute.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or
 * without modification, are permitted provided that the following
 * conditions are met:
 *
 * Redistributions of source code must retain the above copyright
 * notice, this  list of conditions and the following disclaimer.
 *
 * Redistribution in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in
 * the documentation and/or other materials provided with the
 * distribution.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL ETRG OR ITS CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Contributors: Members of EdRP, Dayalbagh Educational Institute
 */
package in.ac.dei.edrp.generalLedger.summaryAccount;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Controller;

@Controller
@RemotingDestination("summaryAccountTemplateController")


public class SummaryAccountTemplateController {
	
	@Autowired
	@Qualifier("SummaryAccountTemplateDaoImpl")
	
	private SummaryAccountTemplateDao summaryAccountTemplateDao;
	
	
	public List<SummaryAccountTemplateInfoBean> getLedgers()
	{
		List<SummaryAccountTemplateInfoBean> ledgers = new ArrayList<SummaryAccountTemplateInfoBean>();
		ledgers = summaryAccountTemplateDao.getLedgers();
		return ledgers;
	}
	
	public String addSummaryAccountTemplate (List<Map<String, String>> add)
	{
		String status = "";
		SummaryAccountTemplateInfoBean input = new SummaryAccountTemplateInfoBean();
		status=summaryAccountTemplateDao.addSummaryAccountTemplate(add, input);	
		return status;
	}
	
	public List<SummaryAccountTemplateInfoBean> getSummaryAccountTemplates()
	{
		List<SummaryAccountTemplateInfoBean> summaryAccountTemplates = new ArrayList<SummaryAccountTemplateInfoBean>();
		summaryAccountTemplates = summaryAccountTemplateDao.getSummaryAccountTemplates();
		return summaryAccountTemplates;
	}
	
	public String deleteSummaryAccountTemplate (String id)
	{
		String status = "";
		status=summaryAccountTemplateDao.deleteSummaryAccountTemplate(id);	
		return status;
	}
	
	public List<SummaryAccountTemplateInfoBean> getSegments()
	{
		List<SummaryAccountTemplateInfoBean> segments = new ArrayList<SummaryAccountTemplateInfoBean>();
		segments = summaryAccountTemplateDao.getSegments();
		return segments;
	}
	
	public String editSummaryAccountTemplate (List<Map<String, String>> edit)
	{
		String status = "";
		SummaryAccountTemplateInfoBean input = new SummaryAccountTemplateInfoBean();
		status=summaryAccountTemplateDao.editSummaryAccountTemplate(edit, input);	
		return status;
	}
	
	public List<SummaryAccountTemplateInfoBean> getSegmentsForEditRecord(String templateId)
	{
		List<SummaryAccountTemplateInfoBean> segmentsForEdit = new ArrayList<SummaryAccountTemplateInfoBean>();
		segmentsForEdit = summaryAccountTemplateDao.getSegmentsForEditRecord(templateId);
		return segmentsForEdit;
	}

	public List<SummaryAccountTemplateInfoBean> getRollUpGroups(String segmentId)
	{
		List<SummaryAccountTemplateInfoBean> rollUpGroups = new ArrayList<SummaryAccountTemplateInfoBean>();
		rollUpGroups = summaryAccountTemplateDao.getRollUpGroups(segmentId);
		return rollUpGroups;
	}
}
